package com.xiaoxing.salesclient.mvp.model;

import android.app.Application;

import com.google.gson.Gson;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;

import com.jess.arms.di.scope.ActivityScope;

import javax.inject.Inject;

import com.xiaoxing.salesclient.mvp.contract.ChanPinXiangQingContract;
import com.xiaoxing.salesclient.mvp.model.entity.OrderBuy;
import com.xiaoxing.salesclient.mvp.model.entity.ProductDetail;
import com.xiaoxing.salesclient.mvp.model.service.SalesService;

import io.reactivex.Observable;


@ActivityScope
public class ChanPinXiangQingModel extends BaseModel implements ChanPinXiangQingContract.Model {
    @Inject
    Gson mGson;
    @Inject
    Application mApplication;

    @Inject
    public ChanPinXiangQingModel(IRepositoryManager repositoryManager) {
        super(repositoryManager);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        this.mGson = null;
        this.mApplication = null;
    }

    @Override
    public Observable<ProductDetail> productDetail(String product_id) {
        return mRepositoryManager.obtainRetrofitService(SalesService.class).productDetail(product_id);
    }

    @Override
    public Observable<OrderBuy> orderBuy(String product_id, String access_token, String product_num) {
        return mRepositoryManager.obtainRetrofitService(SalesService.class).orderBuy(product_id, access_token, product_num);
    }

    @Override
    public Observable<OrderBuy> orderBuy(String product_id, String access_token, String product_num, String is_staff) {
        return mRepositoryManager.obtainRetrofitService(SalesService.class).orderBuy(product_id, access_token, product_num, is_staff);
    }
}